//
//  ST_BTLightBarViewController.swift
//  BTVideo
//
//  Created by DouLei on 2019/7/25.
//  Copyright © 2019 DouLei. All rights reserved.
//

import UIKit
import SnapKit
import SwifterSwift

class ST_BTLightBarViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.backgroundColor = Color.white
        
        view.addSubview(own_navigation_bar)
        own_navigation_bar.snp.makeConstraints { (make) in
            make.right.left.top.equalTo(view)
            make.height.equalTo(statusBarHeight+44)
        }
        own_navigation_bar.addSubview(left_nav_btn)
        own_navigation_bar.addSubview(title_nav_btn)
        own_navigation_bar.addSubview(right_nav_btn)
        
        left_nav_btn.snp.makeConstraints { (make) in
            make.left.equalTo(own_navigation_bar).offset(8)
            make.bottom.equalTo(own_navigation_bar)
            make.width.height.equalTo(44)
        }
        
        right_nav_btn.snp.makeConstraints { (make) in
            make.right.equalTo(own_navigation_bar).offset(-14)
            make.bottom.equalTo(own_navigation_bar)
            make.width.height.equalTo(44)
        }
        
        title_nav_btn.snp.makeConstraints { (make) in
            make.centerY.equalTo(left_nav_btn)
            make.centerX.equalTo(own_navigation_bar)
        }
        
        left_nav_btn.isHidden = hidden_left_btn
        right_nav_btn.isHidden = hidden_right_btn
        title_nav_btn.isHidden = hidden_title_btn
        
    }
    
    
    // MARK: - Properties
    public var hidden_left_btn = false
    
    public var hidden_right_btn = true
    
    public var hidden_title_btn = false
    
    lazy var own_navigation_bar:UIView = {
        let control = UIView()
        control.backgroundColor = Color.white
        return control
    }()
    
    lazy var left_nav_btn:UIButton = {
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        
        control.setImage(ST_ImageUtils.imageName("返回_gray"), for: UIControl.State.normal)
        
        control.imageView?.contentMode = UIView.ContentMode.scaleAspectFit
        
//        control.backgroundColor = Color.random
        
        control.addTarget(self, action: #selector(left_click), for: UIControl.Event.touchUpInside)
        
        return control
    }()
    
    
    lazy var right_nav_btn:UIButton = {
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        
        //        control.cornerRadius = 18
         
//        control.setTitleForAllStates("帮助")
//        control.setTitleColorForAllStates(Color.init(hexString: "#333333")!)
        control.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium)
        control.addTarget(self, action: #selector(right_click), for: UIControl.Event.touchUpInside)
        
        return control
    }()
    
    lazy var title_nav_btn:UIButton = {
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        
        control.setTitleColorForAllStates(Color.init(hexString: "#333333")!)
        
        control.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium)
        
        control.addTarget(self, action: #selector(title_click), for: UIControl.Event.touchUpInside)
        
        return control
    }()
    
    //    MARK: - Event
    
    @objc func left_click(){
        
        self.goback_previous_controller()
        
    }
    
    @objc func title_click(){
        
        
        
    }
    
    @objc func right_click(){
        
        
        
    }
}

